import requests
import pandas as pd
import re
import pymysql

# 连接到数据库
conn = pymysql.connect(
    host='localhost',
    port=3306,
    user='root',
    password='123456',
    database='new_test'
)
 
# 创建游标对象
cursor = conn.cursor()
 
# 执行SQL语句
sql = "SELECT * FROM ai_session_record;"
cursor.execute(sql)
 
# 获取查询结果
results = cursor.fetchall()
print(results);
 
# 关闭游标和数据库连接
cursor.close()
conn.close()